$(function () {
  //正则把URL地址栏中的id截取下来
  let reg = /([^?]+)/g;
  let id = window.location.search.match(reg).join('');
  let li = $('.item')
  let comment = $('#comment');

  //fetch接口+id
  fetch("http://chst.vip:1234/api/getmoneyctrlproduct?productid=" + id)
    .then(body => body.json())
    .then(res => {
      console.log(res);
      let containerStr = ""
      let commentStr = ""
      res.result.forEach(element => {
        let regExp = /(?<=imgurl=)[^'"]*/;;
        let imgUrl = element.productImg2.match(regExp);
        containerStr = `
        <div class="infoR">
          <div class="title">
            <h4>${element.productName}</h4>
          </div>
          <div class="other">
            <span>${element.productFrom} | ${element.productTime}</span>
            <i>${element.productTips}</i>
          </div>
          <div class="container">
            <p>
              <img src="${imgUrl[0]}" alt="">
            ${element.productInfo2}
            </p>
          </div>
          <div class="bigimg">

            <img src="${imgUrl[0]}" alt="">
          </div>
          <div class="city">
            <ul id="disstorck">
            ${element.productCity}
            </ul>
          </div>
        </div>
        `
      commentStr = `${element.productComment}`
      });
      
      //将内容添加到页面中
      li.append(containerStr)
      comment.append(commentStr)

})

})